import psycopg

with psycopg.connect("dbname=examdb user=examdb") as conn:
	with conn.cursor() as cur:
		stmt = 'INSERT INTO test_tbl1 (sn, name) VALUES (%s, %s)'
		for i in range(10):
			sn = 1001 + i
			name = f'test-{sn}'
			cur.execute(stmt, (sn, name) )  # 使用参数


